//处理与区块链智能合约的交互
export const votingFactoryAbi = [
  "function createVote(string voteName, tuple(string name, string signature, string imageUrl)[] candidates, uint256 maxVoters) public returns (uint256)",
  "function castVote(uint256 voteId, uint256 candidateIdx) public",
  "function cancelVote(uint256 voteId) public",
  "function abstain(uint256 voteId) public",
  "function getCandidateVotes(uint256 voteId, uint256 candidateIdx) public view returns (uint256)",
  "function getVoterChoice(address voter, uint256 voteId) public view returns (uint256)",
  "function getVote(uint256 voteId) public view returns (address, string, uint256, uint256, uint256, uint256)",
  "function getVotesCount() public view returns (uint256)",
  "function updateCandidateCount(uint256 voteId, uint256 newCount) public",
  "function addCandidate(uint256 voteId, string name, string signature, string imageUrl) public",
  "function getCandidate(uint256 voteId, uint256 idx) public view returns (string, string, string, address, uint256)",
  "event VoteCreated(address indexed creator, uint256 voteId, string voteName, uint256 createdAt, uint256 maxVoters)",
  "event VoteCast(address indexed voter, uint256 voteId, uint256 candidateIdx)",
  "event VoteCancelled(address indexed voter, uint256 voteId)",
  "event VoteAbstained(address indexed voter, uint256 voteId)",
  "event CandidateCountUpdated(uint256 indexed voteId, uint256 newCount)",
  "event CandidateAdded(uint256 indexed voteId, uint256 candidateIdx, string name, address addedBy)"
];

// 合约地址
export const votingFactoryAddress = "0x1a4e387B6293Bcd2c2d07c7ef064701ec2A242A2";
